from selenium.webdriver.common.by import By     # 引入By类
from pages.base_page import BasePage    # 引入页面基类

# 定义一个主页类，继承页面基类
class IndexCrmPage(BasePage):
    # 定位器
    assert_locator = (By.CSS_SELECTOR,'body > div.container > div.alert.alert-success')     # 登录断言定位器
    clue_locator = (By.LINK_TEXT,'线索')
    client_locator = (By.LINK_TEXT,'客户')
    bo_locator = (By.LINK_TEXT,'商机')
    product_locator = (By.LINK_TEXT,'产品')
    task_locator = (By.LINK_TEXT,'任务')
    schedule_locator = (By.LINK_TEXT,'日程')
    contract_locator = (By.LINK_TEXT,'合同')
    finance_locator = (By.LINK_TEXT,'财务')
    more_locator = (By.LINK_TEXT,"更多")
    log_locator = (By.LINK_TEXT,'日志')
    know_locator = (By.LINK_TEXT,'知识')
    marketing_locator = (By.LINK_TEXT,'营销')
    message_locator = (By.LINK_TEXT,'站内信')
    system_locator = (By.LINK_TEXT, '系统设置')

    # 获取登录成功后的断言文本
    def get_assert_text(self):
        actul = self.driver.find_element(*self.assert_locator).text
        return actul
    # 点击线索，进入线索页面
    def click_clue(self):
        self.driver.find_element(*self.clue_locator).click()
    # 点击客户，进入客户页面
    def click_client(self):
        self.driver.find_element(*self.client_locator).click()
    # 点击商机，进入商机页面
    def click_bo(self):
        self.driver.find_element(*self.bo_locator).click()
    # 点击产品，进入产品页面
    def click_product(self):
        self.driver.find_element(*self.product_locator).click()
    # 点击任务，进入任务页面
    def click_task(self):
        self.driver.find_element(*self.task_locator).click()
    # 点击日程，进入日程页面
    def click_schedule(self):
        self.driver.find_element(*self.schedule_locator).click()
    # 点击合同，进入合同页面
    def click_contract(self):
        self.driver.find_element(*self.contract_locator).click()
    # 点击财务，进入财务页面
    def click_finance(self):
        self.driver.find_element(*self.finance_locator).click()
    # 点击更多下的日志，进入日志页面
    def click_log(self):
        self.driver.find_element(*self.more_locator).click()
        self.driver.find_element(*self.log_locator).click()
    # 点击更多下的知识，进入知识页面
    def click_know(self):
        self.driver.find_element(*self.more_locator).click()
        self.driver.find_element(*self.know_locator).click()
    # 点击更多下的营销，进入营销页面
    def click_marketing(self):
        self.driver.find_element(*self.more_locator).click()
        self.driver.find_element(*self.marketing_locator).click()
    # 点击更多下的站内信，进入站内信页面
    def click_message(self):
        self.driver.find_element(*self.more_locator).click()
        self.driver.find_element(*self.message_locator).click()
    # 点击系统设置，进入系统设置页面
    def click_system_set(self):
        self.driver.find_element(*self.system_locator).click()





